**************************************
***** Stata Self-Learning Course *****
****** University of Goettingen ******
**************************************
********* Scalars & Matrices *********
************** Exercise ************** 
**************************************


* 1.

scalar a=2

matrix define A=J(4,4,2)

// many possibilities to create B, for example:
matrix define B=J(4,4,0)
matrix B[1,1]=2
matrix B[2,2]=2
matrix B[3,3]=2
matrix B[4,4]=2

// or
matrix define B=(2,0,0,0 \ 0,2,0,0 \ 0,0,2,0 \ 0,0,0,2)

// or (if you check the matrix functions: help matrix functions)
matrix B = I(4)*2		
// I(4) gives a 4x4 identity matrix, which is multiplied by 2

scalar list a
matrix list A 
matrix list B


* 2.

mat def C=a*A
mat def D=C+invsym(B)
mat def E=(A,B)\(C,D)
mat def b=E[1,1], E[1,3], E[1,5] 

mat list C
mat list D
mat list E 
mat list b
